<template>
  <div>
    <button @click="getName">点我发送请求11</button>
    <button @click="getHi">点我发送请求22</button>
  </div>
</template>

<script>
  import axios from 'axios'

  export default {
    name: "App",
    methods:{
      getName(){
        axios.get('http://localhost:8081/api1/test1').then(
          response => {
            console.log('收到了数据',response.data);
          },
          error => {
            console.log('错误了',error.message);
          }
        )
      },
      getHi(){
        axios.get('http://localhost:8081/api2/test2').then(
          response => {
            console.log('收到了数据',response.data);
          },
          error => {
            console.log('错误了',error.message);
          }
        )
      }
    }
    
  }
</script>